// SkinLCD.cpp : implementation file
//

#include "stdafx.h"
#include "LoPlayer.h"
#include "SkinLCD.h"

const UINT SKINLCD_UPDATE_TIMER = ::RegisterWindowMessage(_T("{33f5940f-8277-4e5f-8de7-d27ad8aec956}"));
// CSkinLCD

IMPLEMENT_DYNAMIC(CSkinLCD, CStatic)

CSkinLCD::CSkinLCD()
{
}

CSkinLCD::~CSkinLCD()
{
}

BEGIN_MESSAGE_MAP(CSkinLCD, CStatic)
	ON_WM_TIMER()
	ON_WM_DESTROY()
	ON_WM_CREATE()
END_MESSAGE_MAP()



// CSkinLCD message handlers

void CSkinLCD::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	if (SKINLCD_UPDATE_TIMER == nIDEvent){

		SYSTEMTIME SystemTime = {0,};
		GetLocalTime(&SystemTime);
		TCHAR szBuf[128];
		wsprintf (szBuf, _T("%02d:%02d:%02d"), SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond);

		CString strCaption;
		GetWindowText (strCaption);

		if (strCaption != szBuf){
			SetWindowText(szBuf);
			Invalidate();
		}		
	}

	__super::OnTimer(nIDEvent);
}

int CSkinLCD::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CSkinStatic::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here
	SetTimer(SKINLCD_UPDATE_TIMER, 500, NULL);

	return 0;
}

void CSkinLCD::OnDestroy()
{
	__super::OnDestroy();

	// TODO: Add your message handler code here
	VERIFY(KillTimer(SKINLCD_UPDATE_TIMER));
}


